# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'
platform :ios, '12.0'
source 'https://gitcode.net/mirrors/cocoapods/specs.git'
target 'test-ios' do
  # Comment the next line if you don't want to use dynamic frameworks
  use_frameworks!
  
  pod 'Toast-Swift'     #toast
  pod 'MJRefresh'       #MJ刷新控件
  
  # 控件
  pod 'MBProgressHUD'
  pod 'HMSegmentedControl' #顶部切换栏
  pod 'NewPopMenu', '~> 2.0' # 弹窗
  pod 'Kingfisher', '~> 7.0' #图片异步加载类似Gilde
  pod 'YYText' # 强大的文本控件
  # 布局
  pod 'SnapKit', '~> 5.6.0' #约束布局
  # 类似Android的布局 方便
  pod 'TangramKit'
  #Json
  pod 'SwiftyJSON' #JSon
  pod 'ObjectMapper'

  # 数据库
  pod 'FMDB' # 数据库
  pod 'SQLite.swift'
  pod 'GRDB.swift' , '5.12.0'  # 数据库
  
  
  # 网络请求
  pod 'Alamofire'  # net
  pod 'RxAlamofire'  # net
  
  pod 'Moya/RxSwift' # 网络请求
  
  # 函数式
  pod 'RxSwift', '6.5.0'
  pod 'RxCocoa', '6.5.0'
  pod 'NSObject+Rx' #普通类的扩展
  pod 'RxDataSources' #对列表的控件扩展

  pod 'ReactiveCocoa'
  
  # 键值对
  pod 'SwiftyUserDefaults'
  pod 'MMKV'
  
  # 开发工具
  pod 'LookinServer', :configurations => ['Debug']
  pod 'MLeaksFinder', :configurations => ['Debug']
  
  # 日志框架类似Logger
  pod 'CocoaLumberjack/Swift'
  #列表
#  pod 'IGListKit', '~> 4.0.0'

  # 加解密
  pod 'CryptoSwift', '~> 1.7.1' #通用加密
  pod 'SwiftyRSA' #RSA 加密
  
  # TableView CollectionView的
  pod 'Reusable'


  # 类似Diff算法，根据新旧数据进行更新列表
  pod 'DifferenceKit/UIKitExtension'
  
  post_install do|installer|
    
    installer.pods_project.targets.each do |target|
      target.build_configurations.each do |config|
        config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '12.0'
      end
    end
     #解决问题一
     find_and_replace("Pods/FBRetainCycleDetector/FBRetainCycleDetector/Layout/Classes/FBClassStrongLayout.mm",
         "layoutCache[currentClass] = ivars;", "layoutCache[(id)currentClass] = ivars;")
     #解决问题二
     find_and_replace("Pods/FBRetainCycleDetector/fishhook/fishhook.c",
     "indirect_symbol_bindings[i] = cur->rebindings[j].replacement;", "if (i < (sizeof(indirect_symbol_bindings) /
          sizeof(indirect_symbol_bindings[0]))) { \n indirect_symbol_bindings[i]=cur->rebindings[j].replacement; \n }")
  end
  def find_and_replace(dir, findstr, replacestr)
    Dir[dir].each do |name|
      FileUtils.chmod("+w",name) #add
        text = File.read(name)
        replace = text.gsub(findstr,replacestr)
        if text != replace
           puts "Fix: " + name
           File.open(name, "w") { |file| file.puts replace }
           STDOUT.flush
        end
    end
    Dir[dir + '*/'].each(&method(:find_and_replace))
  end
end
